package com.xbongbong.paas.model.impl;

import com.xbongbong.paas.domain.dao.StageWorkLogDao;
import com.xbongbong.paas.domain.entity.StageWorkLogEntity;
import com.xbongbong.paas.model.StageWorkLogModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Auther: yingjianfeng
 * @Date: 2021/11/16 14:58
 * @Description:
 */
@Service("stageWorkLogModel")
public class StageWorkLogModelImpl implements StageWorkLogModel {

    @Resource
    private StageWorkLogDao stageWorkLogDao;
    @Override
    public Integer insert(StageWorkLogEntity entity) throws XbbException {
        return stageWorkLogDao.insert(entity);
    }

    @Override
    public Integer update(StageWorkLogEntity entity) throws XbbException {
        return stageWorkLogDao.update(entity);
    }

    @Override
    public List<StageWorkLogEntity> findEntitys(Map<String, Object> param) {
        return stageWorkLogDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return stageWorkLogDao.getEntitysCount(param);
    }

    @Override
    public List<StageWorkLogEntity> findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }

    @Override
    public void save(StageWorkLogEntity stageWorkLogEntity) {
        if (stageWorkLogEntity.getId() == null){
            stageWorkLogDao.insert(stageWorkLogEntity);
        }else {
            stageWorkLogDao.update(stageWorkLogEntity);
        }
    }

}
